﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using DAL;

namespace BLL
{

    public class LoaiDichVuBLL:BaseBLL
    {
        public List<LoaiDichVu> LayTatCa()
        {
            return DB.LoaiDichVus.ToList();
        }

        public LoaiDichVu LayTheoMa(int ma)
        {
            return DB.LoaiDichVus.Where(ldv => ldv.Ma == ma).FirstOrDefault();
        }

        public LoaiDichVu Them( string ten_en, string ten_ru, string loigioithieu,string hinhanh)
        {
            LoaiDichVu ldv = new LoaiDichVu()
            {
                Ten_EN=ten_en,
                Ten_RU=ten_ru,
                LoiGioiThieu_EN=loigioithieu,
                HinhAnh=hinhanh
            };

            DB.LoaiDichVus.InsertOnSubmit(ldv);
            DB.SubmitChanges();
            return ldv;
        }

        public void Xoa(int ma)
        {
            LoaiDichVu ldv = LayTheoMa(ma);
            DB.LoaiDichVus.DeleteOnSubmit(ldv);

            DB.SubmitChanges();
        }
    }
}
